import os
import logging
import sys


bring_in_stubs = bool(os.environ.get("APPENGINE_STANDALONE", False))
if bring_in_stubs:
    try:
        logging.getLogger().setLevel(logging.DEBUG)
        logging.info("Running in STANDALONE mode for unittesting")

        from google.appengine.tools import dev_appserver
        dev_appserver.SetupStubs('SuperApp',
                              login_url="foo",
                              datastore_path="/dev/null",
                              history_path="/dev/null",
                              clear_datastore=False)
    except ImportError, exc:
        logging.info("running on cloud", exc_info=True)
